package com.qiantu.phone.ui.activity;

import android.content.Intent;
import android.view.View;

import com.hjq.widget.layout.SettingBar;
import com.qiantu.phone.R;
import com.qiantu.phone.app.AppActivity;
import com.qiantu.phone.ui.dialog.BottomDelayTimeDialog;
import com.qiantu.phone.ui.uiutil.LLSceneLinkageUtil;
import com.qiantu.phone.utils.LinkageDataHolder;
import com.qiantu.phone.utils.TempDataHolder;
import com.lxj.xpopup.XPopup;

import java.io.Serializable;
import java.util.Map;

public class AddTaskActivityNew extends AppActivity {

    private SettingBar oneKeyTask;
    private BottomDelayTimeDialog mBottomDelayTimeDialog;
    private int mPosition;
    private int type;
    private int sceneType;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_add_task;
    }

    @Override
    protected void initView() {
        oneKeyTask = findViewById(R.id.one_key_scene_task);
        type = getInt("type");
        sceneType = getInt("sceneType", 1);
        oneKeyTask.setVisibility(View.VISIBLE);
        setOnClickListener(R.id.device_task, R.id.delay_task, R.id.push_task, R.id.linkage_task, R.id.one_key_scene_task);
    }

    @Override
    protected void initData() {
        mPosition = getIntent().getIntExtra("position", -1);
    }


    @Override
    public void onClick(View view) {
        int id = view.getId();
        switch (id) {
            case R.id.device_task: {
                Map<String,Integer> taskData = (Map<String, Integer>) getIntent().getSerializableExtra("taskData");
                Intent intent = new Intent(this, DeviceActionActivityNew.class);
                intent.putExtra("position", mPosition);
                intent.putExtra("type", type);
                intent.putExtra("sceneType", sceneType);
                intent.putExtra("taskData", (Serializable) taskData);
                startActivity(intent);
                break;
            }
            case R.id.push_task: {
                Intent intent = new Intent(this, PushMessageSettingActivityNew.class);
                intent.putExtra("position", mPosition);
                intent.putExtra("type", type);
                intent.putExtra("sceneType", sceneType);
                startActivity(intent);
                break;
            }
            case R.id.linkage_task: {
                Intent intent = new Intent(this, LinkageStartStopActivityNew.class);
                intent.putExtra("position", mPosition);
                intent.putExtra("type", type);
                intent.putExtra("sceneType", sceneType);
                startActivity(intent);
                break;
            }
            case R.id.one_key_scene_task: {
                Intent intent = new Intent(this, OnKeySceneSelectActivityNew.class);
                intent.putExtra("position", mPosition);
                startActivity(intent);
                break;
            }
        }
    }


}